package com.flx.at.spring.code.test.testbeanlifecycle;

import com.flx.at.spring.code.test.testbeanlifecycle.component.LifeCycleA;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: Fenglixiong
 * @Date: 2021/7/3 18:41
 * @Description:
 */
@Configuration
public class LifeCycleConfig {

    /**
     * 容器启动会创建lifeCycleA实例，并调用init方法，容器销毁会调用destroy方法
     * @return
     */
    @Bean(initMethod = "init",destroyMethod = "destroy")
    public LifeCycleA lifeCycleA(){
        return new LifeCycleA();
    }

}
